# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=allegro
pkgver=5.2.7.0
pkgrel=5
arch="all"
url="https://liballeg.org"
pkgdesc="Portable library mainly aimed at video game and multimedia programming"
license="BSD-3-Clause"
makedepends="
	alsa-lib-dev
	cmake
	flac-dev
	glu-dev
	gtk+3.0-dev
	libjpeg-turbo-dev
	libtheora-dev
	libvorbis-dev
	libwebp-dev
	libxcursor-dev
	libxi-dev
	mesa-dev
	pulseaudio-dev
	xorg-server-dev
	"
source="https://github.com/liballeg/allegro5/archive/$pkgver/allegro5-$pkgver.tar.gz
	0001-Use-the-compatibility-aliases-for-accessing-struct-i.patch
	"
subpackages="$pkgname-dev"
builddir="$srcdir/allegro5-$pkgver"

build() {
	# sdl2 is disabled for now as it's experimental still
	# and the tests are crashing on it
	# https://github.com/liballeg/allegro5/issues/1229
	cmake -B build \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DALLEGRO_SDL=OFF \
		-DWANT_TESTS=ON \
		-DWANT_EXAMPLES=OFF \
		-DWANT_DEMO=OFF
	cmake --build build
}

check() {
	cd build
	tests/test_driver --no-display ../tests/test_*.ini
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
2b9b90e59f0f440ba90fe3fac0153245e96c46524c24fce74502569c2395a67aee73b83e4503ea21e7fe078113c4fb5752c984858e7f0647c9fa332415ddd3fe  allegro5-5.2.7.0.tar.gz
a376d987998cb30e5d1367da7d42277d8b9b774f091271f4c921b2d61716af5567c184cd36b23ca52d91724f13b3600612f507abc7cdfbfbfa70d559bb83f9d7  0001-Use-the-compatibility-aliases-for-accessing-struct-i.patch
"
